﻿$(document).ready(function () {
    jQuery.expr[':'].Contains = function (a, i, m) {
        return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
    };

    function listFilter(header, list) { // header is any element, list is an unordered list
     
        var input = $("#contact_searchquery");
        $(input)
            .change(function () {
                var filter = $(this).val();
                if (filter) {
                    $matches = $(list).find('a:Contains(' + filter + ')').parent();
                    $('li', list).not($matches).slideUp();
                    $matches.slideDown();

                } else {
                    $(list).find("li").slideDown();
                }
                return false;
            })
            .keyup(function () {
                // fire the above change event after every letter
                $(this).change();
            });
    }
    //ondomready
    $(function () {
        listFilter($("#contact_searchquery"), $(".modal-body"));
    });
} (jQuery));

